<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta charset="utf-8" />
		<title>MyPetStore后台</title>

		<meta name="description" content="User login page" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

		<!-- bootstrap & fontawesome -->
		<link rel="stylesheet" href="/assets/css/bootstrap.min.css" />
		<link rel="stylesheet" href="/assets/font-awesome/4.5.0/css/font-awesome.min.css" />

		<!-- text fonts -->
		<link rel="stylesheet" href="/assets/css/fonts.googleapis.com.css" />

		<!-- ace styles -->
		<link rel="stylesheet" href="/assets/css/ace.min.css" />

		<!--[if lte IE 9]>
		<link rel="stylesheet" href="/assets/css/ace-part2.min.css"/>
		<![endif]-->
		<link rel="stylesheet" href="/assets/css/ace-rtl.min.css" />

		<!--[if lte IE 9]>
		<link rel="stylesheet" href="/assets/css/ace-ie.min.css"/>
		<![endif]-->

		<!-- HTML5shiv and Respond.js for IE8 to support HTML5 elements and media queries -->

		<!--[if lte IE 8]>
		<script src="/assets/js/html5shiv.min.js"></script>
		<script src="/assets/js/respond.min.js"></script>
		<![endif]-->
	</head>

	<body class="login-layout light-login">
		<div class="main-container">
			<div class="main-content">
				<div class="row">
					<div class="col-sm-10 col-sm-offset-1">
						<div class="login-container">
							<div class="center">
								<h1>
<!--									<i class="ace-icon fa fa-leaf green"></i>-->
									<span class="white">MyPetStore</span>
									<span class="white" id="id-text2">后台管理系统</span>
								</h1>
<!--								<h4 class="blue" id="id-company-text">&copy; MyPetstore</h4>-->
							</div>

							<div class="space-6"></div>

							<div class="position-relative">
								<div id="login-box" class="login-box visible widget-box no-border">
									<div class="widget-body">
										<div class="widget-main">
											<h4 class="header black lighter bigger">
<!--												<i class="ace-icon fa fa-coffee blue"></i>-->
												请输入账号密码
											</h4>

											<div class="space-2"></div>
											<div id="alert" class="alert-danger hidden">
												<div id="alertMsg"></div>
											</div>
											<form>
												<fieldset>
													<label class="block clearfix">
														<span class="block input-icon input-icon-right">
															<input id="username" type="text" class="form-control" placeholder="账号" />
<!--															<i class="ace-icon fa fa-user"></i>-->
														</span>
													</label>

													<label class="block clearfix">
														<span class="block input-icon input-icon-right">
															<input id="password" type="password" class="form-control" placeholder="密码" />
<!--															<i class="ace-icon fa fa-lock"></i>-->
														</span>
													</label>

													<div class="space"></div>

													<div class="clearfix">
														<label class="inline">
															<input type="checkbox" class="ace" />
															<span class="lbl"> 记住密码 </span>
														</label>

														<button id="loginBtn" type="button" class="width-35 pull-right btn btn-sm btn-primary">
<!--															<i class="ace-icon fa fa-key"></i>-->
															<span class="bigger-110">登录</span>
														</button>
													</div>

													<div class="space-4"></div>
												</fieldset>
											</form>

											<div class="social-or-login center">
												<span class="bigger-110">csu.MyPetStore</span>
											</div>

											<div class="space-6"></div>

<!--											<div class="social-login center">-->
<!--												<a class="btn btn-primary">-->
<!--													<i class="ace-icon fa fa-facebook"></i>-->
<!--												</a>-->

<!--												<a class="btn btn-info">-->
<!--													<i class="ace-icon fa fa-twitter"></i>-->
<!--												</a>-->

<!--												<a class="btn btn-danger">-->
<!--													<i class="ace-icon fa fa-google-plus"></i>-->
<!--												</a>-->
<!--											</div>-->
										</div><!-- /.widget-main -->

										<div class="toolbar clearfix">
											<div>
												<a href="#" data-target="#forgot-box" class="forgot-password-link">
<!--													<i class="ace-icon fa fa-arrow-left"></i>-->
<!--													忘记密码?-->
												</a>
											</div>

											<div>
												<a href="#" data-target="#signup-box" class="user-signup-link">
<!--													注册-->
<!--													<i class="ace-icon fa fa-arrow-right"></i>-->
												</a>
											</div>
										</div>
									</div><!-- /.widget-body -->
								</div><!-- /.login-box -->

								<div id="forgot-box" class="forgot-box widget-box no-border">
									<div class="widget-body">
										<div class="widget-main">
											<div id="ale" class="alert-danger hidden">
												<div id="alertM"></div>
											</div>
											<h4 class="header red lighter bigger">
<!--												<i class="ace-icon fa fa-key"></i>-->
												重新获取密码
											</h4>

											<div class="space-6"></div>
											<p>
												请输入你的邮箱重新获取密码
											</p>

											<form>
												<fieldset>
													<label class="block clearfix">
														<span class="block input-icon input-icon-right">
															<input id="emailbox" type="email" class="form-control" placeholder="邮箱" />
<!--															<i class="ace-icon fa fa-envelope"></i>-->
														</span>
													</label>

													<div class="clearfix">
														<button id="find" type="button" class="width-35 pull-right btn btn-sm btn-danger">
<!--															<i class="ace-icon fa fa-lightbulb-o"></i>-->
															<span class="bigger-110">发送</span>
														</button>
													</div>
												</fieldset>
											</form>
										</div><!-- /.widget-main -->

										<div class="toolbar center">
											<a href="#" data-target="#login-box" class="back-to-login-link">
												返回登陆
<!--												<i class="ace-icon fa fa-arrow-right"></i>-->
											</a>
										</div>
									</div><!-- /.widget-body -->
								</div><!-- /.forgot-box -->

								<div id="signup-box" class="signup-box widget-box no-border">
									<div class="widget-body">
										<div class="widget-main">
											<h4 class="header green lighter bigger">
<!--												<i class="ace-icon fa fa-users black"></i>-->
												新的管理员账号
											</h4>

											<div class="space-6"></div>
											<p> 请输入你的账号信息: </p>

											<form>
												<fieldset>
													<div id="aler" class="alert-danger hidden">
														<div id="alertMs"></div>
													</div>
													<input id="truecode" type="hidden" value="" />
													<label class="block clearfix">
														<span class="block input-icon input-icon-right">
															<input id="email" type="email" class="form-control" placeholder="邮箱" />
<!--															<i class="ace-icon fa fa-envelope"></i>-->
														</span>
													</label>

													<label class="block clearfix">
														<span class="block input-icon input-icon-right">
															<input id="user" type="text" class="form-control" placeholder="账号" />
<!--															<i class="ace-icon fa fa-user"></i>-->
														</span>
													</label>

													<label class="block clearfix">
														<span class="block input-icon input-icon-right">
															<input id="ps" type="password" class="form-control" placeholder="密码" />
<!--															<i class="ace-icon fa fa-lock"></i>-->
														</span>
													</label>

													<label class="block clearfix">
														<span class="block input-icon input-icon-right">
															<input type="password" class="form-control" placeholder="再次输入密码" />
<!--															<i class="ace-icon fa fa-retweet"></i>-->
														</span>
													</label>
													<label class="block clearfix">
														<span class="block input-icon input-icon-right">
															<input id="phone" type="text" class="form-control" placeholder="手机号码" />
<!--															<i class="ace-icon fa fa-retweet"></i>-->
														</span>
													</label>
													<div class="clearfix">
													<button  id='getCode' type="button" class="width-65 pull-right btn btn-sm btn-success">
														<span  class="bigger-110">获取验证码</span>

<!--														<i class="ace-icon fa fa-arrow-right icon-on-right"></i>-->
													</button>
														</div >


													<label class="block clearfix">
														<span class="block input-icon input-icon-right">

															<input id="code" type="text" class="form-control" placeholder="短信验证码" />
<!--															<i class="ace-icon fa fa-retweet"></i>-->

														</span>
													</label>


													<label class="block">
														<input type="checkbox" class="ace" />
														<span class="lbl">
															我同意遵守
															<a href="#">管理员规章</a>
														</span>
													</label>

													<div class="space-24"></div>

													<div class="clearfix">
														<button type="reset" class="width-30 pull-left btn btn-sm">
<!--															<i class="ace-icon fa fa-refresh"></i>-->
															<span class="bigger-110">重置</span>
														</button>

														<button  id='signup' type="button" class="width-65 pull-right btn btn-sm btn-success">
															<span  class="bigger-110">注册</span>

<!--															<i class="ace-icon fa fa-arrow-right icon-on-right"></i>-->
														</button>
													</div>
												</fieldset>
											</form>
										</div>

										<div class="toolbar center">
											<a  href="#" data-target="#login-box" class="back-to-login-link">
<!--												<i class="ace-icon fa fa-arrow-left"></i>-->
												返回登陆
											</a>
										</div>
									</div><!-- /.widget-body -->
								</div><!-- /.signup-box -->
							</div><!-- /.position-relative -->

<!--							<div class="navbar-fixed-top align-right">-->
<!--								<br />-->
<!--								&nbsp;-->
<!--								<a id="btn-login-dark" href="#">Dark</a>-->
<!--								&nbsp;-->
<!--								<span class="blue">/</span>-->
<!--								&nbsp;-->
<!--								<a id="btn-login-blur" href="#">Blur</a>-->
<!--								&nbsp;-->
<!--								<span class="blue">/</span>-->
<!--								&nbsp;-->
<!--								<a id="btn-login-light" href="#">Light</a>-->
<!--								&nbsp; &nbsp; &nbsp;-->
<!--							</div>-->
						</div>
					</div><!-- /.col -->
				</div><!-- /.row -->
			</div><!-- /.main-content -->
		</div><!-- /.main-container -->

		<!-- basic scripts -->

		<!--[if !IE]> -->
		<script src="/assets/js/jquery-2.1.4.min.js"></script>

		<!-- <![endif]-->

		<!--[if IE]>
		<script src="/assets/js/jquery-1.11.3.min.js"></script>
		<![endif]-->
		<script type="text/javascript">
			if('ontouchstart' in document.documentElement) document.write("<script src='/static/assets/js/jquery.mobile.custom.min.js'>"+"<"+"/script>");
		</script>

		<!-- inline scripts related to this page -->
		<script type="text/javascript">
			jQuery(function($) {
			 $(document).on('click', '.toolbar a[data-target]', function(e) {
				e.preventDefault();
				var target = $(this).data('target');
				$('.widget-box.visible').removeClass('visible');//hide others
				$(target).addClass('visible');//show target
				 $('#alert').addClass('hidden');
				 $('#password').val("");
			 });
			});
			jQuery(function ($) {
				$('#getCode').on('click',function (e) {
					if ($('#phone').val()===""){
						$('#alertMs').text("手机号码不能为空");
						$('#aler').removeClass('hidden');
					}else {
						var phone = $('#phone').val();

						$.ajax({
							type:"get",
							url:"/jpetstore/getCode",
							data:{
								"phone":phone
							},
							dataType:"text",

							success:function(data) {
								console.log(data);
								console.log(data);
								console.log(data);
								$('#truecode').val(data);
								console.log($('#truecode').val());
							}
						})
					}
					e.preventDefault();
				});
			});
			jQuery(function ($) {
				$('#find').on('click',function (e) {
					if ($('#emailbox').val()==""){
						$('#alertM').text("邮箱不能为空");
						$('#ale').removeClass('hidden');
					}else {
						var email = $('#emailbox').val();

						$.ajax({
							type:"get",
							url:"/jpetstore/find",
							data:{
								"email":email
							},
							dataType:"text",

							success:function(data){
								if (data == "fail"){

									$('#alertM').text("邮箱地址不正确");
									$('.alert-danger.hidden').removeClass('hidden');

								}else {
									$('#ale').addClass('alert-success');
									$('#ale').removeClass('alert-danger hidden');
									setTimeout(function () {//做延时以便显示登录状态值
										$('#alertM').text("正在发送邮件中...")
										console.log(data);
										//window.location.href = "/jpetstore/main";//指向登录的页面地址
									},100)
								}
							}
						})
					}
					e.preventDefault();
				});
			});
			
			jQuery(function ($) {
				$('#loginBtn').on('click',function (e) {
					if ($('#username').val()==""||$('#password').val()==""){
						$('#alertMsg').text("账号或密码不能为空");
						$('#alert').removeClass('hidden');
					}else {
						var username = $('#username').val();
						var password = $('#password').val();
						$.ajax({
							type:"get",
							url:"/jpetstore/checklogin",
							data:{
								"username":username,
								"password":password
							},
							dataType:"text",

							success:function(data){
								if (data == "fail"){

									$('#alertMsg').text("账号或密码不正确");
									$('.alert-danger.hidden').removeClass('hidden');
									$('#password').val("");
								}else {
									$('#alert').addClass('alert-success');
									$('#alert').removeClass('alert-danger hidden');
									setTimeout(function () {//做延时以便显示登录状态值
										$('#alertMsg').text("正在登陆中...")
										console.log(data);
										window.location.href = "/jpetstore/order";//指向登录的页面地址
									},100)
								}
							}
						})
					}
					e.preventDefault();
				});
			});
			jQuery(function ($) {
				$('#signup').on('click',function (e) {
					if ($('#user').val()==""||$('#ps').val()==""||$('#email').val()==""){
						$('#alertMs').text("输入的信息不能为空");
						$('#aler').removeClass('hidden');
					}else {
						var username = $('#user').val();
						var password = $('#ps').val();
						var email=$('#email').val();
						var truecode = $('#truecode').val();
						var code = $('#code').val();
						var phone = $('#phone').val();
						$.ajax({
							type:"get",
							url:"/jpetstore/signup",
							data:{
								"username":username,
								"password":password,
								"email":email,
								"truecode":truecode,
								"code":code,
								"phone":phone
							},
							dataType:"text",

							success:function(data){
								if (data == "fail"){

									$('#alertMs').text("注册失败，用户名已被使用过");
									$('.alert-danger.hidden').removeClass('hidden');
									$('#password').val("");
								}else {
									$('#aler').addClass('alert-success');
									$('#aler').removeClass('alert-danger hidden');
									setTimeout(function () {//做延时以便显示登录状态值
										$('#alertMs').text("注册成功...")
										console.log(data);
									//	window.location.href = "login-box";//指向登录的页面地址
									},100)
								}
							}
						})
					}
					e.preventDefault();
				});
			});
			
			//you don't need this, just used for changing background
			jQuery(function($) {
			 $('#btn-login-dark').on('click', function(e) {
				$('body').attr('class', 'login-layout');
				$('#id-text2').attr('class', 'white');
				$('#id-company-text').attr('class', 'black');
				
				e.preventDefault();
			 });
			 $('#btn-login-light').on('click', function(e) {
				$('body').attr('class', 'login-layout light-login');
				$('#id-text2').attr('class', 'grey');
				$('#id-company-text').attr('class', 'black');
				
				e.preventDefault();
			 });
			 $('#btn-login-blur').on('click', function(e) {
				$('body').attr('class', 'login-layout blur-login');
				$('#id-text2').attr('class', 'white');
				$('#id-company-text').attr('class', 'light-black');
				
				e.preventDefault();
			 });
			 
			});
		</script>
	</body>
</html>
